﻿package com.tudou.home.newskin.buttons
{
    import com.tudou.consts.*;
    import com.tudou.skin.*;
    import com.tudou.skin.common.button.*;
    import com.tudou.utils.*;
    import flash.display.*;

    public class RateButton extends PolySelectButton
    {

        public function RateButton(param1:int, param2:Boolean)
        {
            var _loc_6:int = 0;
            var _loc_7:InteractiveObject = null;
            var _loc_3:* = new RateSelectBackgroundMC();
            super(_loc_3, null, null);
            var _loc_4:Array = [];
            [][RateType.P256] = new P256UnselectBTN();
            _loc_4[RateType.P360] = new P360UnselectBTN();
            _loc_4[RateType.P480] = new P480UnselectBTN();
            _loc_4[RateType.P720] = new P720UnselectBTN();
            _loc_4[RateType.ORIGINAL] = new OriginalUnselectBTN();
            var _loc_5:* = RateUtil.getAvailable(param1, param2);
            var _loc_8:int = 0;
            while (_loc_8 < _loc_5.length)
            {
                
                _loc_6 = _loc_5[_loc_8];
                _loc_7 = _loc_4[_loc_6] as InteractiveObject;
                _loc_7.mouseEnabled = false;
                addStateButton(_loc_7, 2, 4, _loc_6.toString());
                _loc_8++;
            }
            this.setBackground(RectDisplayUtil.getShape(_loc_3.width, _loc_3.height, 0, 0));
            this.clickContainer = true;
            addRollOverOut(new RateRollOverOutSprite());
            return;
        }// end function

    }
}

class RateRollOverOutSprite extends Sprite implements IOverOut
{
    private var over:DisplayObject;
    private var out:DisplayObject;

    function RateRollOverOutSprite()
    {
        over = new RateOverMC();
        out = new RateOutMC();
        addChild(over);
        addChild(out);
        isOver = false;
        return;
    }// end function

    public function getDisplay() : DisplayObject
    {
        return this;
    }// end function

    public function set isOver(param1:Boolean) : void
    {
        over.visible = param1;
        out.visible = !param1;
        return;
    }// end function

}

